<?php
include("functions.php");
include("libs/smarty.class.php");

$smarty = new Smarty();

$practices = array();
$practice_id = $_GET['id'];

if($practice_id!=''){
    $sql = mysql_query("SELECT p.*,
        (SELECT name FROM companies co WHERE (p.company_id = co.id)) AS company_name,
        (SELECT city FROM cities ci WHERE (p.city_id = ci.id)) AS city
        FROM practices p WHERE p.id ='$practice_id' ");

    while($row = mysql_fetch_assoc($sql)){
        $practices[] = $row;
    }
    $smarty->assign("practices",$practices);
}
$smarty->display('practice_details.tpl');
?>
